<%@ page import="com.hf.constant.OrderLunchConst"%>
<!DOCTYPE html>
<html>
<head>
<meta name="layout" content="mainUser">
<title>Today Ordered List</title>
</head>
<body>
	<div id="container">

		<g:if test="${errorMessage}">
			<h2>
				${errorMessage}
			</h2>
		</g:if>
		<g:else>
			<h2>Your Order Setting:</h2>

			<div class="dataDiv">
				<div class="fieldcontain ">
					<label for="isOrderFrequent"> <g:message
							code="orderUser.isOrderFrequent.label"
							default="Is Order Frequent" />

					</label>
					<g:checkBox name="isOrderFrequent" />
				</div>
			</div>

			<div class="dataDiv">
				<input type="button" class="btn" id="update" value="update" />
			</div>


			<div>
				Note: 取消此选项后, 每工作日不发通知订餐邮件到邮箱 <br>长时间不订餐, 请取消此选项
			</div>
		</g:else>
	</div>
	<jq:jquery>
		$('#isOrderFrequent').prop('checked', ${session?.user?.isOrderFrequent});

		$('#update').live('click',function(e){
			e.preventDefault();
			var data = {'isOrderFrequent':$('#isOrderFrequent').is(':checked')};
			$.ajax({
				type:'POST',
				url: '/orderLunch/orderUser/updateSetting',
				data: data,
				success:function(result){
					alert('success');
				}
			});
		});
	</jq:jquery>
</body>
</html>